package controllers

import (
	"io/ioutil"
	"path"

	beego "github.com/beego/beego/v2/server/web"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {
	c.Data["Website"] = "beego.me"
	c.Data["Email"] = "astaxie@gmail.com"
	c.TplName = "index.html"
}

func (c *MainController) GetVotes() {
	file := path.Join("static", "json", "data.json")
	b, _ := ioutil.ReadFile(file)
	c.Ctx.WriteString(string(b))
}
